#ifndef CORE_METAL_H
#define CORE_METAL_H

#include "Material.h"
#include "Hitable.h"
#include "Utility.h"

namespace RayTracer
{
	class Metal : public Material
	{
	public:
		Metal(const vec3& a, float f) : albedo(a),fuzz(f) {}

		virtual bool Scatter(
			const Ray& r_in, const HitRecord& rec, 
			vec3& attenuation, Ray& scattered ) const override 
		{
			vec3 reflected = glm::reflect(glm::normalize(r_in.direction()), rec.normal);
			scattered = Ray(rec.position, reflected + fuzz * RandomSphere());
			attenuation = albedo;
			return (glm::dot(scattered.direction(), rec.normal) > 0);
		}
		float& GetFuzz() { return fuzz; }
		vec3& Albedo() { return albedo; }
	private:
		vec3 albedo;
		float fuzz;
	};
}
#endif // !CORE_METAL_H
